package com.ptszyxx.popose.module.main.message.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.ptszyxx.popose.R;
import com.ptszyxx.popose.databinding.ItemMessageNoticeBinding;
import com.ptszyxx.popose.module.main.message.vm.MessageNoticeVM;
import com.ysg.http.data.entity.notice.NoticeEntity;

public class MessageNoticeAdapter extends BaseQuickAdapter<NoticeEntity, BaseDataBindingHolder<ItemMessageNoticeBinding>> {

    private MessageNoticeVM viewModel;
    private Presenter mPresenter = new Presenter();


    public MessageNoticeAdapter(MessageNoticeVM viewModel) {
        super(R.layout.item_message_notice);
        this.viewModel = viewModel;
    }

    @Override
    protected void convert(BaseDataBindingHolder<ItemMessageNoticeBinding> holder, NoticeEntity item) {
        ItemMessageNoticeBinding binding = holder.getDataBinding();
        if (binding != null) {
            binding.setEntity(item);
            binding.setViewModel(viewModel);
            binding.setPresenter(mPresenter);
            binding.setPosition(holder.getBindingAdapterPosition());
            binding.executePendingBindings();
        }
    }

    public static class Presenter{
        public void onItemClick(MessageNoticeVM viewModel, NoticeEntity entity){
            viewModel.jumpMessageNoticeDetail(entity);
        }
    }








}
